package cn.shujuhai.cms.domain;

import cn.shujuhai.common.domain.BaseDomain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author: zhangDeZhong
 * @Date: 2024/12/5 12:01
 * @Description: info_article信息文章表的实体类
 **/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("info_article")
public class InfoArticle extends BaseDomain {
    /**
     * 文章ID
     */
    @TableId(type = IdType.AUTO)
    private Long articleId;

    /**
     * 排序值
     */
    private Long sort;

    /**
     * 文章标题
     */
    @NotNull(message = "文章标题不能为空")
    @Size(max = 100, message = "文章标题长度不能超过100个字符")
    private String title;

    /**
     * 发布状态(待审核：0，待发布：1，已发布：2，被驳回：3)
     */
    private Integer status;

    /**
     * 文章头图路径
     */
    private String resourceUrl;

    /**
     * 文章描述
     */
    @NotNull(message = "文章描述不能为空")
    @Size(max = 500, message = "文章描述长度不能超过200个字符")
    private String description;

    /**
     * 文章作者
     */
    @Size(max = 30, message = "文章作者长度不能超过30个字符")
    private String author;

    /**
     * 文章浏览量
     */
    private Long count;

    /**
     * 驳回理由
     */
    private String reason;
    /**
     * 文章发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime publishedTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime articleTime;
    /**
     * 栏目ID
     */
    @NotNull(message = "栏目不能为空")
    private Long channelId;

    /**
     * 文章附件路径
     */
    private String attachmentUrl;

    /**
     * 文章内容
     */
    @TableField(exist = false)
    private String content;

    /**
     * 文章内容ID
     */
    @TableField(exist = false)
    private Long contentId;

    /**
     * 栏目名称
     */
    @TableField(exist = false)
    private String channelName;

    /**
     * 栏目路径
     */
    @TableField(exist = false)
    private String urlKey;

    @TableField(exist = false)
    private List<Long> channelIds;
    @TableField(exist = false)
    private String channels;
    @TableField(exist = false)
    private String channelNames;
    @TableField(exist = false)
    private List<ArticleParam> infoParam;
}
